﻿<%@ page language="java" pageEncoding="UTF-8"%>
<%@ page import="java.util.*" %> 
<%@ page import="com.hs.core.utils.*,cn.ac.cintcm.dataconverge.util.Constants,cn.ac.cintcm.dataconverge.researcher.domain.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

List orgList = (ArrayList)request.getAttribute("orgList");
List groupList = (ArrayList)request.getAttribute("groupList"); 
List keyList = (ArrayList)request.getAttribute("keyList"); 
Researcher obj = (Researcher)request.getAttribute("obj");
String msg = (String)request.getAttribute("msg")==null?"":(String)request.getAttribute("msg");;
  
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>    
    <title><%=Constants.APP_TITLE %>--专家信息</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    
    <script src="<%=basePath%>index/Scripts/Script.js" language="javascript" type="text/javascript"></script>
    <script language="javascript" type="text/javascript" src="<%=path %>/js/My97DatePicker/WdatePicker.js"></script>
    <script language="javascript" src="<%=path %>/js/common.js"></script>
     <script language="javascript" src="<%=path %>/js/check.js"></script>
    <script src='<%=basePath%>dwr/engine.js'></script>
     <script src='<%=basePath%>dwr/util.js'></script> 
     <script src='<%=basePath%>dwr/interface/subject.js'></script> 
      <link href="<%=basePath%>index/Themes/com/style.css" rel="stylesheet" type="text/css" />
    <script language="JavaScript" type="text/JavaScript">
      function checkUserAcc(){ 
          var userId = dwr.util.getValue("id");
          if(isNull(userId)){
          		alert("请输入登陆帐号");
          		form1.id.focus();
          		return;
          }
          if(!checkName(userId)){
             alert("登陆的帐号须为数字、字母和下划线的组合!");
             form1.id.focus();
          	 return;
          } 
          subject.checkUserId(userId,callBackForCheckId);
      }
      var flag = true;
      function callBackForCheckId(message){
      	  if("0" != message){
      	    if("1" == message)
      	       alert("此帐号可以使用");
      	    if("2" == message){
      	       alert("此帐号已存在，不可注册");
      	       flag = false;
      	    }
      	  }
      }
      function callBackForCheckId1(message){
      	  if("0" != message){ 
      	    if("2" == message){ 
      	       flag = false;
      	    }
      	  }
      }
      function changeGraduateInfo(){
	      	var graduateInfo = document.getElementById("graduateInfo").value; 
      	if(graduateInfo =="s" || graduateInfo =="0"){
      		document.getElementById("schoolTime").style.display="none";
      	}else{
      	    document.getElementById("schoolTime").style.display="block";
      	}
	      	 
      } 
      function changeOrg(){
         var orgId = dwr.util.getValue("org");
         if(orgId != "0"){
            dwr.util.removeAllOptions("department");
            subject.getDeptList(orgId,callBackForChange);
         }
      
      }
      function callBackForChange(dataStr){
         if(''!= dataStr){ 
          	dwr.util.addOptions("department", eval(dataStr),'id','name');  
         }  
      }
      function submitForm(){
          flag = true;
          var userId = dwr.util.getValue("id");
          if(isNull(userId)){
          		alert("请输入登陆帐号");
          		form1.id.focus();
          		return;
          }
          if(!checkName(userId)){
             alert("登陆的帐号须为数字、字母和下划线的组合!");
             form1.id.focus();
          	 return;
          } 
          subject.checkUserId(userId,callBackForCheckId1);  
          setTimeout("checkForm();",1000)
          
          
          
      }
      function checkForm(){
          if(!flag){
             alert("该用户名已注册");
             return;
          }
          var password = dwr.util.getValue("password");
          var passworda = dwr.util.getValue("passworda");
          var org = dwr.util.getValue("org");
          var name = dwr.util.getValue("name"); 
          var idcard = dwr.util.getValue("idcard");
          var position = dwr.util.getValue("position");
          var zhicheng = dwr.util.getValue("zhicheng");
          var qualification = dwr.util.getValue("qualification");
          var group = dwr.util.getValue("group");
           var department = dwr.util.getValue("department");
            var birthday = dwr.util.getValue("birthday");
          if(isNull(password)){
             alert("请输入密码");
             form1.password.focus();
             return;
          }
          if(isNull(passworda)){
             alert("请输入确认密码");
             form1.passworda.focus();
             return;
          }
          if(password != passworda){
          	 alert("两次输入密码不一致"); 
             return;
          }
            
          if("0" == org){
             alert("请选择所属单位");
             form1.org.focus();
             return;
          }
          if(isNull(name)){
             alert("请输入姓名");
             form1.name.focus();
             return;
          }
          if(isNull(idcard)){
             alert("请输入身份证号");
             form1.idcard.focus();
             return;
          } 
          if(!CheckValue(idcard)){ 
          		form1.idcard.focus();
          		return; 
          } 
         /** if("0" == position){
             alert("请选择学科角色");
             form1.position.focus();
             return;
          }*/
            if(isNull(birthday)){ 
                 alert("请输入出生日期");
          		form1.birthday.focus();
          		return; 
          } 
          if("0" == zhicheng){
             alert("请选择职称");
             form1.zhicheng.focus();
             return;
          }
          if("0" == qualification){
             alert("请选择学位");
             form1.qualification.focus();
             return;
          }  
           form1.submit(); 
      }
    
      // alert("id须为数字、字母和下划线的组合!"); 
    </script>
  </head>
 
<body  class="idt_body" scroll="yes"> 
  <form method="post" name="form1" action="expert.htm?action=expertSave">
  <table cellpadding="0" cellspacing="0" width="100%" height="100%" id="Table8">
  
        <tr>
            <td  valign="top" height="100%"> 
                            <table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0" id="Table11">
                                <tr  id="ldTR">
                                    <td  valign="top">
                                        <!------------------ 标题栏 ------------------>
                                        <!--- 标题 ---->
                                        <table class="idt_tle_mg" cellspacing="0" cellpadding="0" width="100%">
                                            <tr  >
                                                <td class="idt_tle_i">
                                                    <img id="imgForm6" src="<%=basePath%>index/Themes/com/idt_tle_o.gif"></td>
                                                <td class="idt_tle_f1">
                                                   专家信息</td>
                                            </tr>
                                        </table>
      <div id="tdForm1">
             <table class="idt_fim_mg" cellspacing="1" cellpadding="0" width="100%" id="">
                 <tr id="tab1">
                     <td>
	   					<fieldset align="center">
			                <legend class="com_legend">登录信息 </legend>
			                <div id="Tr1" align="center"  class="content">&nbsp;</div>
							<table  border="0" cellpadding="0" cellspacing="1" width="100%" class="com_fieldset_tab">
							   <tr>
							      <td class="fim_l" width="15%">登录帐号</td>
							      <td class="fim_r" colspan="3">
							      <input class="com_textbox" type="text" name="id" style="width:70%" value="<%=obj==null?"":obj.getIda()%>"/>
							      <input   type="hidden" name="ids"   value="<%=obj==null?"":obj.getIds()%>"/>
							      <font color="red">*</font>
							      &nbsp;<input type="button" class="com_textbox"   value="检测帐号是否可用" onclick="checkUserAcc();"/></td>
							      
							    </tr>
							    <tr>
							      <td class="fim_l" width="15%">密码</td>
							      <td class="fim_r" width="35%" nowrap>
							      <input class="com_textbox" style="width:95%" type="password" name="password" maxlength="25" ><font color="red">*</font></td>
							        
							      <td class="fim_l" width="15%">确认密码</td>
							      <td class="fim_r" nowrap  >
							      <input class="com_textbox" type="password" name="passworda" maxlength="25"  style="width:95%"><font color="red">*</font></td>
								   
							    </tr> 
							     <tr>
							      <td class="fim_l">所属单位</td>
							      <td class="fim_r" nowrap>
							     <select id="org" name="org" onchange="changeOrg();" style="width:95%" >
							     		 <option value="0">请选择所属单位</option>
							             <%
							               for(int k = 0;k<orgList.size();k++){
							            	   Organization org = (Organization)orgList.get(k);
							            	   out.println("<option value="+org.getId());
							            	   if(obj != null && (obj.getOrg().getId()+"").equals(org.getId()+"")){
							            		   out.println(" selected");
							            	   }
							            	   out.println(">");
							            	   out.println(org.getName());
							            	   out.println("</option>");
							               }
							             
							             %>
								 	 </select><font color="red">*</font> 
							      </td>
								   <td class="fim_l">所属部门 </td>
							       <td class="fim_r" nowrap> 
							      <select id="department" name="department" style="width:95%" > 
								  </select>
								  </td>
							    </tr>
							</table>
     					</fieldset>
				   </td>
				  </tr> 
				    <tr id="tab1">
                     <td>
	   					<fieldset align="center">
			                <legend class="com_legend">基本信息 </legend>
			                <div id="Tr1" class="content">
			                    &nbsp;</div>
							<table  border="0" cellpadding="0" cellspacing="1" width="100%" class="com_fieldset_tab">  
							  <tr>
							      <td class="fim_l" width="15%">姓名</td>
							      <td class="fim_r" width="35%">
							        <input class="com_textbox" type="text" name="name" style="width:95%" value="<%=obj == null?"":obj.getName()%>"  /><font color="red">*</font></td>
							       
							       <td class="fim_l" width="15%">身份证号</td>
								   <td class="fim_r" width="35%" nowrap>
									    <input class="com_textbox" style="width:95%" type="text" name="idcard" value="<%=obj==null?"":obj.getIdcard()%>"  />
									    <font color="red">*</font>
									  </td> 
								  </tr>
								  <tr>
								   <td class="fim_l">出生日期</td> 
							       <td class="fim_r" nowrap>
								  	<input name="birthday" class="com_textbox" type="text" value="<%=obj==null?"":Tools.getDateStringByDate1(obj==null?null:obj.getBirthday())%>" maxlength="10" style="width:95%"  onFocus="WdatePicker({el:'birthday',dateFmt:'yyyy-MM-dd'})"/>
								     <font color="red">*</font>
								   </td>
									   <td class="fim_l">性别</td>
								      <td class="fim_r">
									  	<input type="radio" value="2" name="sex" <%if(obj!=null&&(obj.getSex()+"").equals("2")){out.print(" checked");} %>/>男&nbsp;<input type="radio" value="1" name="sex" <%if(obj!=null&&(obj.getSex()+"").equals("1")){out.print(" checked");} %>/>女
									  </td>
								  </tr>
								  <tr>
								      
								  <td class="fim_l">是否在读研究生</td>
							       <td class="fim_r" >
							         <select id="graduateInfo" name="graduateInfo" onchange="changeGraduateInfo();" style="width:95%">
							             <option value="0">请选择是否在读研究生</option>
								  	 <option value="s" <%if(obj!= null && "s".equals(obj.getGraduateInfo())){out.print(" selected");}%>>不是在读研究生</option>
										 <option value="d" <%if(obj!= null && "d".equals(obj.getGraduateInfo())){out.print(" selected");}%>>在读硕士</option>
										 <option value="e" <%if(obj!= null && "e".equals(obj.getGraduateInfo())){out.print(" selected");}%>>在读博士</option>
								      </select>
								      </td>
								      <td class="fim_r" colspan=2>
								      <span id="schoolTime" style="display:<%if(obj!= null && "d".equals(obj.getGraduateInfo())||obj!= null &&"d".equals(obj.getGraduateInfo())){out.print("");}else{out.print("none");}%>">
								      <select id="admissionTime" name="admissionTime" style="width:95%">
									      <option value="0">请选择入学年份</option> 
									      <%
									        java.util.Date date2=new java.util.Date();
									        int year2=date2.getYear()+1900;
									        int begin=year2-10;
									        for(int i = begin;i<= year2;i++){
									        	out.println("<option value=");
									        	out.println(i);
									        	if((i+"").equals(obj==null?"":obj.getAdmissionTime()+""))
									        	   out.println(" selected");
									        	out.println(">");
									        	out.println(i+"年入学");
									        	out.println("</option>");
									        }
									      %> 
								      </select></span> 
								  </td>
							    </tr>
							    <tr> 
							      <td class="fim_l" width="15%">毕业院校</td>
							      <td class="fim_r" width="35%">
							      <input class="com_textbox" name="graduateIns" value="<%=StringUtilTool.NULL2Blank(obj==null?"":obj.getGraduateIns()) %>" style="width:95%"/></td>
							
							      <td class="fim_l" width="15%">专业</td>
							      <td class="fim_r">
							      <input class="com_textbox" name="major" type="text" value="<%=StringUtilTool.NULL2Blank(obj==null?"":obj.getMajor()) %>" style="width:95%"/>
							      </td>      
							    </tr>
							    <tr>
							      <td class="fim_l" width="15%">院重点学科</td>
							      <td class="fim_r" width="35%">
							        <select name="keySubject" style="width:95%">
							             <option value="0">请选择院重点学科</option> 
							              <%
							               for(int k = 0;k<keyList.size();k++){
							            	   SystemDict dict = (SystemDict)keyList.get(k);
							            	   out.println("<option value="+dict.getId());
							            	   if((dict.getId()+"").equals(obj==null?"":obj.getKeySubject())){
							            		   out.println(" selected");
							            	   }
							            	   out.println(">");
							            	   out.println(dict.getName());
							            	   out.println("</option>");
							               }
							             %>
							             
							              <option value="其它">其它</option> 
							          </select>
							      </td> 
							      <td class="fim_l" width="15%">学科角色</td>
							      <td class="fim_r" width="35%">
							        <select name="position" style="width:95%">
							            <option value="0" <%if("0".equals(obj==null?"":obj.getPosition())){out.println(" selected");} %>>请选择学科角色</option>     
								  		<option value="1" <%if("1".equals(obj==null?"":obj.getPosition())){out.println(" selected");} %>>学术带头人</option>
								  		<option value="2" <%if("2".equals(obj==null?"":obj.getPosition())){out.println(" selected");} %>>学科带头人</option>
										<option value="3" <%if("3".equals(obj==null?"":obj.getPosition())){out.println(" selected");} %>>参与人员</option>
									 
								 	  </select> 
							      </td>
							      </tr>
							      <tr>
								  <td class="fim_l" width="15%">职称</td>
								  
							      <td class="fim_r" >
							         <select name="zhicheng" style="width:95%">
							          <option value="0">请选择职称</option>
								  		<option value="1" <%if("1".equals(obj==null?"":obj.getZhicheng())){out.println(" selected");} %>>正高</option>
								  		<option value="2" <%if("2".equals(obj==null?"":obj.getZhicheng())){out.println(" selected");} %>>副高</option>
										<option value="3" <%if("3".equals(obj==null?"":obj.getZhicheng())){out.println(" selected");} %>>中级</option>
										<option value="4" <%if("4".equals(obj==null?"":obj.getZhicheng())){out.println(" selected");} %>>初级</option>
										<option value="5" <%if("5".equals(obj==null?"":obj.getZhicheng())){out.println(" selected");} %>>其他</option>
								 	  </select><font color="red">*</font>
								  </td> 
								  <td class="fim_l">学位</td>
							      <td class="fim_r">
							       <select name="qualification" style="width:95%">
							       <option value="0">请选择学位</option>
								  		<option value="1" <%if("1".equals(obj==null?"":obj.getQualification()+"")){out.println(" selected");} %>>本科</option>
								  		<option value="2" <%if("2".equals(obj==null?"":obj.getQualification()+"")){out.println(" selected");} %>>硕士</option>
										<option value="3" <%if("3".equals(obj==null?"":obj.getQualification()+"")){out.println(" selected");} %>>博士</option>
										<option value="4" <%if("4".equals(obj==null?"":obj.getQualification()+"")){out.println(" selected");} %>>博士后</option>
										<option value="5" <%if("5".equals(obj==null?"":obj.getQualification()+"")){out.println(" selected");} %>>中专</option>
										<option value="6" <%if("6".equals(obj==null?"":obj.getQualification()+"")){out.println(" selected");} %>>大专</option>
										<option value="7" <%if("7".equals(obj==null?"":obj.getQualification()+"")){out.println(" selected");} %>>其它</option>
								 	  </select><font color="red">*</font>
								 	  </td>
							    </tr>
							</table>
     					</fieldset>
				   </td>
				  </tr>
				  
				  
				    <tr id="tab1">
                     <td>
	   					<fieldset align="center">
			                <legend class="com_legend">联系方式 </legend>
			                <div id="Tr1" class="content">
			                    &nbsp;</div>
							<table  border="0" cellpadding="0" cellspacing="1" width="100%" class="com_fieldset_tab">
							  <tr>
							      <td class="fim_l" width="15%">通信地址 </td>
							      <td class="fim_r" width="35%"><input class="com_textbox" name="address" style="width:95%" value="<%=StringUtilTool.NULL2Blank(obj==null?"":obj.getAddress()) %>"/></td>
							      <td class="fim_l" width="15%">邮编</td>
							      <td class="fim_r"><input class="com_textbox" name="postNo" style="width:95%" value="<%=StringUtilTool.NULL2Blank(obj==null?"":obj.getPostNo()) %>"></td>
							    </tr>
							    <tr>
							      <td class="fim_l">固定电话/院分机号</td>
							      <td class="fim_r"><input class="com_textbox" name="officePhone" style="width:95%" value="<%=StringUtilTool.NULL2Blank(obj==null?"":obj.getOfficePhone()) %>"></td>
								  <td class="fim_l">传真</td>
							      <td class="fim_r"><input class="com_textbox" name="fax" style="width:95%" value="<%=StringUtilTool.NULL2Blank(obj==null?"":obj.getFax()) %>"></td>
							    </tr>
							    <tr>
							      <td class="fim_l">移动电话</td>
							      <td class="fim_r"><input class="com_textbox" name="cellphone" style="width:95%" value="<%=StringUtilTool.NULL2Blank(obj==null?"":obj.getCellphone()) %>"/></td>
							       <td class="fim_l">邮件地址</td>
							      <td class="fim_r"><input class="com_textbox" name="email" style="width:95%" value="<%=StringUtilTool.NULL2Blank(obj==null?"":obj.getEmail()) %>"></td>
							    </tr>
							</table>
     					</fieldset>
				   </td>
				  </tr>
  </table>
  <table cellspacing="0" cellpadding="0" width="100%" class="idt_bottom_mg" border="0">
        <tr>
            <td align="right">
                <input  class="com_btn2" id="Button1" name="save" type="button" onclick="submitForm();" value="提交" >&nbsp;&nbsp;&nbsp;&nbsp;
               <input type="button" value="取消" name="B4" class="com_btn2" id="Button2" onclick="javascript:window.close();">
            </td>
        </tr>
  </table>             
      </table>
            </td>
        </tr>
    </table></form>
  </body>
</html>
<script type="text/javascript">
<!--
<%if(!"".equals(msg)){%> 
   alert('<%=msg%>');
   window.close();
    window.opener.location.replace(window.opener.location.href); 

<%}%>
//-->
</script>
